home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / code_lib / codlb103 / codelib.mdb / libs.json
Encoding:
JavaScript Object Notation  |  1994-06-07  |  7.9 KB

  1. {
  2.     "schema": {
  3.         "ID": "Text (25)",
  4.         "Desc": "Text (50)",
  5.         "data": "Memo/Hyperlink (255)"
  6.     },
  7.     "data": [
  8.         {
  9.             "ID": "centerform()",
  10.             "Desc": "centers a form in vb",
  11.             "data": "Sub CenterForm (Frm As Form)\r\n'-- Places a form in the middle of the screen\r\n    \r\n    Frm.Left = (Screen.Width - Frm.Width) \\ 2\r\n    Frm.Top = (Screen.Height - Frm.Height) \\ 2\r\n\r\nEnd Sub\r\n"
  12.         },
  13.         {
  14.             "ID": "Restartwin()",
  15.             "Desc": "Restarts windows",
  16.             "data": "'REM ** How To Restart Windows **\r\n'REM ** Place API below in MODULE **\r\n\r\nDeclare Function ExitWindows% Lib \"User\" (ByVal dwReserved&, ByVal wReturnCode%)\r\nx% = ExitWindows(66, 66)"
  17.         },
  18.         {
  19.             "ID": "Shell to dos",
  20.             "Desc": "Shell to dos from vb",
  21.             "data": "Function ToShellToDos (commandline As String) As Long\r\n\r\nRem ** Routine To Shell To Dos And Stay In This Routine Until Task Is Complete **\r\n  s% = Shell(commandline$)        'shells out with the command in commandline$\r\n    While GetModuleUsage(s%)      'checks to see if finished\r\n      x% = DoEvents()                     'allows it to continue if unfinished.\r\n    Wend\r\n  ToShellToDos = s%               'returns task ID or error code from function.\r\nEnd Function"
  22.         },
  23.         {
  24.             "ID": "helptoc()",
  25.             "Desc": "loads the winhelp table of contents",
  26.             "data": "Dim temp As Integer\r\n\r\nDim HelpFile As String\r\n\r\n\r\nHelpFile = app.Path & \"\\Hwin.hlp\"\r\ntemp = WinHelp(Main.hWnd, HelpFile, &H3, \" \")\r\n"
  27.         },
  28.         {
  29.             "ID": "searchhelp()",
  30.             "Desc": "search for help on",
  31.             "data": "Sub Hsearch_Click ()\r\nDim DummyVal As String\r\nDim temp As Integer\r\nDim HelpFile As String\r\n\r\nHelpFile = app.Path & \"\\Hwin.hlp\"\r\nDummyVal = \" \"\r\ntemp% = WinHelp(Main.hWnd, HelpFile, &H105, DummyVal$)\r\n\r\nEnd Sub\r\n"
  32.         },
  33.         {
  34.             "ID": "helponHelp()",
  35.             "Desc": "loads windows help",
  36.             "data": "Dim temp As Integer\r\nDim dummy As String\r\nDim HelpFile As String\r\n\r\nHelpFile = \"winhelp.hlp\"\r\ntemp = WinHelp(Main.hWnd, HelpFile, &H4, \" \")\r\n"
  37.         },
  38.         {
  39.             "ID": "MakeTopmost",
  40.             "Desc": "Makes a window the topmost window (floating)",
  41.             "data": "Declare Function SetWindowPos Lib \"user\" (ByVal h%, ByVal hb%,\r\n        ByVal x%, ByVal y%, ByVal cx%, ByVal cy%, ByVal f%) As Integer\r\n' The above Declare statement must appear on one line.\r\n\r\nGlobal Const SWP_NOMOVE = 2\r\nGlobal Const SWP_NOSIZE = 1\r\nGlobal Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE\r\nGlobal Const HWND_TOPMOST = -1\r\nGlobal Const HWND_NOTOPMOST = -2\r\n\r\n\r\n'this lines goes in the formload\r\nsuccess% = SetWindowPos (FORMNAME.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)\r\nREM success% <> 0 When Successful\r\n"
  42.         },
  43.         {
  44.             "ID": "setpreinst()",
  45.             "Desc": "Sets to pre instance when another is started",
  46.             "data": " Declare Function FindWindow% Lib \"user\" (ByVal lpClassName As Any,\r\n      ByVal lpCaption As Any)\r\n   Declare Function ShowWindow% Lib \"User\" (ByVal Handle As Integer,\r\n      ByVal Cmd As Integer)\r\n   Declare Function SFocus% Lib \"User\" Alias \"SetFocus\" (ByVal Handle As\r\n       Integer)\r\n\r\n'4. Put the following code in the Form1.Load event:\r\n\r\n   Title$ = \"Test Program\"\r\n   X% = CheckUnique(Title$)\r\n   If X% = 0 Then\r\n      End\r\n   End If\r\n   Form1.Caption= Title$\r\n\r\n'5. Create the following general function:\r\n\r\n\r\n   Function CheckUnique (FormName As String) As Integer\r\n      Dim Handle As Integer\r\n      Handle = FindWindow(0&, FormName)\r\n\r\n      If Handle = 0 Then\r\n         ' -1 is a true value.\r\n         CheckUnique = -1\r\n      Else\r\n         X% = ShowWindow(Handle, 1)\r\n         X% = SFocus(Handle)\r\n         ' 0 is a false value.\r\n         CheckUnique = 0\r\n      End If\r\n   End Function\r\n"
  47.         },
  48.         {
  49.             "ID": "butcall()",
  50.             "Desc": "code for inside the place call button",
  51.             "data": "    PhoneNum$ = Text3.Text      '-- Phone number\r\n    If Len(PhoneNum$) = 0 Then\r\n        Beep\r\n        StatusPrint \"You must enter a phone number\"\r\n        Exit Sub\r\n    End If\r\n\r\n    Attempts = Val(Text2.Text)  '-- Number of attempts\r\n    Timeout = 45                '-- Wait up to 45 seconds\r\n\r\n'----------------------------------------------------------------\r\n    \r\n    cmdPlaceCall.Enabled = False\r\n\r\n    '-- Place the call\r\n    Call PlaceCall(Comm1, PhoneNum$, Attempts, Timeout, Result, ModemBaud&, RealBaud&, Mode$)\r\n\r\n    cmdPlaceCall.Enabled = True\r\n\r\n    '-- What happenned?\r\n    Select Case MWError()\r\n        Case MW_PLACECALL_OK\r\n            '-- PlaceCall returned a valid result code. Check Result\r\n            Select Case Result\r\n                Case MW_RESULT_CONNECT      '-- CONNECT\r\n                    Msg$ = \"Connected at \" & Format$(ModemBaud&)\r\n                    If Len(Mode$) Then\r\n                        Msg$ = Msg$ & \" using \" & Mode$\r\n                    End If\r\n                Case MW_RESULT_BUSY         '-- BUSY\r\n                    Msg$ = \"The line is busy. Try again later\"\r\n                Case MW_RESULT_NO_DIALTONE  '-- NO DIALTONE\r\n                    Msg$ = \"There is no dialtone. Check connections and try again\"\r\n                Case MW_RESULT_NO_CARRIER   '-- NO CARRIER\r\n                    Msg$ = \"The other modem did not respond\"\r\n                Case MW_RESULT_TIMEOUT      '-- TIMEOUT\r\n                    Msg$ = \"The other modem did not respond\"\r\n                Case Else\r\n                    Msg$ = Result2Str$(Comm1, Result)\r\n            End Select\r\n        Case Else\r\n            Msg$ = MWErrorMsg$()\r\n    End Select\r\n\r\n    Beep\r\n    StatusPrint Msg$\r\n"
  52.         },
  53.         {
  54.             "ID": "Hostmode",
  55.             "Desc": "code for go to host mode button",
  56.             "data": "\r\n    NumRings = Val(Text4.Text)\r\n    If NumRings = 0 Then NumRings = 1\r\n\r\n'--------------------------------------------\r\n\r\n    cmdWaitForCall.Enabled = False\r\n\r\n    '-- Wait for a call\r\n    Call WaitForCall(Comm1, NumRings, ModemBaud&, RealBaud&, Mode$)\r\n\r\n    cmdWaitForCall.Enabled = True\r\n    \r\n    Select Case MWError()\r\n        Case MW_WAITFORCALL_OK\r\n            '-- Connected\r\n            Msg$ = \"Connected at \" & Format$(ModemBaud&)\r\n            If Len(Mode$) Then\r\n                Msg$ = Msg$ & \" using \" & Mode$\r\n            End If\r\n        Case Else\r\n            Msg$ = MWErrorMsg$()\r\n    End Select\r\n    \r\n    Beep\r\n    StatusPrint Msg$\r\n"
  57.         },
  58.         {
  59.             "ID": "sendcommand()",
  60.             "Desc": "code for send commands to modem button",
  61.             "data": "\r\n    Cmd$ = Text5.Text\r\n    Attempts = 2    '-- Standard (1 retry)\r\n    Timeout = 10    '-- Normally you shouldn't need more than 10 seconds\r\n    \r\n'-------------------------------------------------------------------------------\r\n\r\n    '-- Send the command to the modem\r\n    Call SendModemCmd(Comm1, Cmd$, Attempts, Timeout, Result)\r\n\r\n    '-- What happenned?\r\n    Select Case MWError()\r\n        Case MW_SENDMODEMCMD_OK\r\n            Msg$ = \"Modem Responded: \" & Result2Str$(Comm1, Result)\r\n        Case Else\r\n            Msg$ = MWErrorMsg$()\r\n    End Select\r\n\r\n    Beep\r\n    StatusPrint Msg$\r\n"
  62.         },
  63.         {
  64.             "ID": "statusprint",
  65.             "Desc": "prints to the status bar",
  66.             "data": "Sub statusprint (msg$)\r\n    form1!info.Caption = msg$\r\nEnd Sub\r\n"
  67.         },
  68.         {
  69.             "ID": "Sleep()",
  70.             "Desc": "Waits for a number of seconds",
  71.             "data": "Sub sleep (waittime As Single)\r\n\r\nDim starttime As Single\r\nDim dummy\r\n\r\n    starttime = Timer\r\n    Do While Timer < (starttime + waittime)\r\n        dummy = DoEvents()\r\n    Loop\r\nEnd Sub\r\n"
  72.         },
  73.         {
  74.             "ID": "decl printerstruc",
  75.             "Desc": "declrations for landscape mode on ptr",
  76.             "data": "Type OrientStructure\r\n      Orientation As Long\r\n      Pad As String * 16\r\n   End Type\r\n   ' Enter the following Declare statement on one, single line:\r\n   Declare Function Escape% Lib \"GDI\" (ByVal hDc%, ByVal nEsc%, ByVal nLen%, lpData As OrientStructure, lpOut As Any)"
  77.         },
  78.         {
  79.             "ID": "landscape exec",
  80.             "Desc": "puts printer into landscape mode",
  81.             "data": "Orient.Orientation = 2\r\n\r\n      '* Send escape sequence to change orientation\r\n      x% = Escape(Printer.hDC, GETSETPAPERORIENT,\r\n                Len(Orient), Orient, NULL)\r\n      '* The EndDoc will now re-initialize the printer\r\n      Printer.EndDoc\r\n"
  82.         }
  83.     ]
  84. }